﻿using System;
using System.Collections.ObjectModel;
using Newtonsoft.Json;
using WP8DataModel.Model;

namespace CeskyRozhlasWP8.Model
{
    public class ScheduleBlob
    {
        public long Id { get; set; }

        [JsonProperty(PropertyName = "RecordedUri")]
        public String RecordedUri { get; set; }
    }

    public class ShortStationDescription
    {
        public int Id { get; set; }

        [JsonProperty(PropertyName = "ShortName")]
        public String ShortName { get; set; }
        [JsonProperty(PropertyName = "Description")]
        public String Description { get; set; }
    }

    public class DetailedScheduleItem
    {
        public int Id { get; set; }

        [JsonProperty(PropertyName = "Title")]
        public String Title { get; set; }
        [JsonProperty(PropertyName = "Description")]
        public String Description { get; set; }

        [JsonProperty(PropertyName = "ShortName")]
        public String ShortName { get; set; }
        [JsonProperty(PropertyName = "StartTime")]
        public DateTime StartTime { get; set; }
        [JsonProperty(PropertyName = "StopTime")]
        public DateTime StopTime { get; set; }
        [JsonProperty(PropertyName = "StationId")]
        public int StationId { get; set; }

        public BackgroundScheduledTransferItem ToBackgroundScheduledTransferItem(String iStationName)
        {
            return new BackgroundScheduledTransferItem
            {
                StartTime = this.StartTime,
                AutoPlay = false,
                AutoStop = false,
                DownloadLater = false,
                ShowId = this.Id,
                ShowTitle = this.Title,
                StationId = this.StationId,
                StationTitle = iStationName,
                StopTime = this.StopTime
            };
        }
    }


    public class AudioStreamExpanded
    {
        public int Id { get; set; }

        [JsonProperty(PropertyName = "Container")]
        public String Container { get; set; }
        [JsonProperty(PropertyName = "Uri")]
        public String Uri { get; set; }
        [JsonProperty(PropertyName = "Bitrate")]
        public int Bitrate { get; set; }
        [JsonProperty(PropertyName = "Vbr")]
        public bool Vbr { get; set; }
        [JsonProperty(PropertyName = "Stereo")]
        public bool Stereo { get; set; }
        [JsonProperty(PropertyName = "StationId")]
        public int StationId { get; set; }
        [JsonProperty(PropertyName = "ShortName")]
        public String ShortName { get; set; }
        [JsonProperty(PropertyName = "Description")]
        public String Description { get; set; }

    }

    public class GroupName
    {
        public int Id { get; set; }

        [JsonProperty(PropertyName = "Name")]
        public String Title { get; set; }

    }
    public class PlayingNow
    {
        public int Id { get; set; }

        [JsonProperty(PropertyName = "Title")]
        public String Title { get; set; }
        [JsonProperty(PropertyName = "Description")]
        public String Description { get; set; }
        [JsonProperty(PropertyName = "GroupId")]
        public int GroupId { get; set; }
        [JsonProperty(PropertyName = "ShortName")]
        public String ShortName { get; set; }
        [JsonProperty(PropertyName = "StartTime")]
        public DateTime StartTime { get; set; }
        [JsonProperty(PropertyName = "StopTime")]
        public DateTime StopTime { get; set; }
    }
    public class StationsGroup
    {

        public StationsGroup()
        {
            Items = new ObservableCollection<PlayingNow>();
        }

        // MemberCanBePrivate.Global is disabled, because resharper cannot spot those members used in XAML
        // ReSharper disable MemberCanBePrivate.Global
        // ReSharper disable UnusedAutoPropertyAccessor.Global
        public int UniqueId { get; set; }
        public string Title { get; set; }
        public string Subtitle { get; set; }
        public string Description { get; set; }
        public string ImagePath { get; set; }

        public ObservableCollection<PlayingNow> Items { get; set; }



        public override string ToString()
        {
            return Title;
        }
    }

}
